package com.digitalchina.lxnsy.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.base.BaseAdapter;
import com.digitalchina.lxnsy.entity.TechnologyVO;
import com.digitalchina.lxnsy.viewholder.SearchTechnologyHolder;

import java.util.List;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.adapter
 * 创建人：郑皓
 * 创建时间：2017/1/14 15:27
 * 修改备注：
 * ================================================
 */
public class SearchTechnologyAdapter extends BaseAdapter<SearchTechnologyHolder, TechnologyVO.QuestionBean> {

    public SearchTechnologyAdapter(Context context, List<TechnologyVO.QuestionBean> listData) {
        super(context, listData);
    }

    @Override
    public View buildConvertView(LayoutInflater layoutInflater, ViewGroup parent) {
        return inflate(R.layout.item_technology_search, parent);
    }

    @Override
    public SearchTechnologyHolder buildHolder(View convertView) {
        SearchTechnologyHolder holder = new SearchTechnologyHolder();
        holder.tvTitle = (TextView) convertView.findViewById(R.id.item_search_tv_title);
        holder.tvNumber = (TextView) convertView.findViewById(R.id.item_search_tv_number);
        return holder;
    }

    @Override
    public void bindViewData(SearchTechnologyHolder holder, TechnologyVO.QuestionBean questionVO, int position) {
        holder.tvTitle.setText(questionVO.getTitle());
        holder.tvNumber.setText(questionVO.getAnswerCount() + "个回答");
    }
}
